package test1;
import java.sql.*;
public class MyConnection {
    private String url = "";
    private String ServerName = "";
    private String PortNo = "";
    private String DBName = "";
    private String UserName = "";
    private String Password = "";
    private Connection conn;

    public MyConnection(String server_name, String port_no, String Database_name,
            String user, String pass) throws SQLException {
        ServerName = server_name;
        PortNo = port_no;
        DBName = Database_name;
        UserName=user;
        Password=pass;
        url = "jdbc:mysql://" + ServerName + ":" + PortNo + "/" + DBName;
        conn = DriverManager.getConnection(url,UserName, Password);
    }

    public int ExecuteUpdate(String sql) throws SQLException {
        Statement st = conn.createStatement();
        return st.executeUpdate(sql);
    }
}

